Proposal by Saad Touhbi for Modbus Industrial Automation Communications Protocol

Proposed by Saad Touhbi (profile, biography)


This is my proposal to execute the Smalltalk Modbus Industrial Automation Communications Protocol project for GsoC 2013.   I want to do this project because it gives another purpose of the use of Smalltalk in the industrial domain, and I am planning to use Smaltalk on my PhD to create a multi agent route optimisation system.. I was also impressed of how easy it is to establish a test driven development process on Smalltalk while working on the Laser Game tutorial 2, and how easy it is to develop with Smalltalk.

 

I believe I can be successful at this due to my experience in Oriented Object development, I am now working as a freelancer with a company and I have been doing a lot of Java applications. I am a fast learner since I have been working on many projects with new programming languages and was able to succeed in my tasks. I have  experience in network programming and client/server systems from working on a project that enables clients to do secure financial transactions via SMS. We were able to come up with a new protocol that wraps the SMS protocol to enable secure communication between mobile client, and server application.

 

How will I do the project

I will start with a study of the Modbus Protocol Specification 1.  I will experiment with the protocol interactively using a Modbus simulator.  Then I will consider how to translate the protocol to a Smalltalk environment (Pharo) which will involve an oriented object modelling.  After, I will practice using the serial interface from inside Pharo, first to a loopback text terminal and then to the Modbus simulator. Then I will develop the core and extensions which will help implement ModbusASCII, ModbusRTU and ModbusTCP. 

 

Unit tests will be developed in parallel with the main development which will lead to test a lot of scenarios.  If there is sufficient time I will try to learn and apply one of the test coverage tools to review the code.  Not only we will do unit tests, but I will use the Modbus protocol simulator to perform some integration tests to find the limits of each part of the protocol.  This may give us new ways to optimize the protocol in the new environment. Following successful testing against the Modbus simulator, next thing we will test against a physical I/O module to test a real world device. Another thing is that we will get the protocol running on the Pharo Community CI server.

 

What methodologies will I use

The modelling and development process will be done in an agile way. I aim to contact with my mentor often and let him judge the deliverables in a periodic way. I will be using a Test Driven Development as demonstrated at 2 which is very suitable to this kind of project that needs enhanced testing from unit tests and test coverage to improve tests on simulators and real world devices.   I will use Smalltalk hub for source code management to collaborate with my mentor.  I will aim to be liberal with class & method comments.

 

Timeline and milestones

Since I am using an agile approach, I choose for this project a one week cycle to validate each milestone deliverable with the mentor. The preliminary planning is as follows:

Week

Start Date

Tasks

0

Pre-start

Since I am new to Smalltalk, prior to the official kick-off I will be doing Smalltalk tutorials to become familiar with the programming environment.

1

17/06/13

Analyse Modbus protocol specifics. Experiment with Modbus simulator. Experiment with the serial interface from inside Pharo to a loopback text terminal and get this to work with the simulator.

2

24/06/13

Try coding a single successful data transfer to the simulator through whatever hard-coded fakery hack necessary. Produce first draft on modeling the Smalltalk implementation of the protocol.

3

01/07/13

Continue modelling core functions of the protocol. Scope  an achievable subset of the protocol. Define order in which protocol functions will be implemented. Agree upon this with the mentor.

4

08/07/13

Start preparing unit tests and developing the core of ModbusASCII.

5

15/07/13

Complete ModbusASCII. Test against the simulator.

6

22/07/13

Start implementing ModbusRTU.

7

29/07/13

Write midterm report.  Depending on success, purchase hardware I/O for week 10. Complete ModbusRTU. Testing against the simulator.

8

05/08/13

Experiment with Pharo TCPIP networking. Start implementing ModbusTCP.

9

12/08/13

Complete ModbusTCP.  Test it against the simulator.

10

19/08/13

Test the against a real hardware I/O module.

11

26/08/13

Add last modifications after the test on the physical I/O module.

12

02/09/13

Do the necessary documentation.  Wrap the library into deployable Configuration package.

13

09/09/13

Get the protocol running as a job on the Pharo Community CI server

14

16/09/13

Stop coding. Write final report.

 

Where I see the risks

Risk

Mitigation

Since this is an industrial protocol, the most difficult thing is the protocol working well with real devices. 

This is why even with a lot of tests using the simulator, it is planned to get a hardware I/O module

Trouble deciphering the Modbus protocol.

Starting with ASCII subpart of specification simplifies interactive testing. Mentor has practical experience “using” Modbus.  Can refer to C source code examples.

Unfamiliarity with Smalltalk.

I am currently reading and doing Smalltalk tutorials for practice.

Trouble interfacing Pharo serial port and/or serial loopback device.

Will seek community support for examples.  Alternatively can bypass and move straight to ModbusTCP implementation.

Trouble with Pharo TCPIP networking in Pharo. 

Will seek community support for examples.  Alternatively can expanding the scope of ModbusASCII and ModbusRTU.

Motivation

Correspond often with my mentor.  Also I am planning on using Smalltalk for my PhD so this practical experience in Smalltalk is of great value.

 

How the results will look

The result will be delivered as a library package with a deployed Configuration package. Smalltalkhub will be used as the code repository.  The package will be set up to run on the Pharo Community CI server.

 

1 http://www.modbus.org/specs.php

2 http://squeak.preeminent.org/tut2007/html/

 

 




Updated: 3.5.2013